<template>
  <pageTabelLayout>
    <template #pageHeader>
      <div class="search-form isheader" v-if="headerShow">
        <div>
          <a-form size="small" :model="pageData" layout="inline" v-if="permissionStore.hasPermisson('jyxmxq.xz')">
            <a-form-item label="项目名称">
              <!-- <a-select popup-container="html"  class="bacClass" :style="{ width: '200px' }" :loading="loading" @search="handleSearch"
                                v-model="pageData.dropDownData" :filter-option="false" allow-search allow-clear
                                @focus="focusSel">
                                <a-option v-for="item in pageData.DefectNameList" :value="item['propertyName']">{{
                                        item["propertyName"]
                                }}
                                </a-option>
                            </a-select> -->

              <a-input allow-clear :style="{ width: '200px' }" class="bacClass" placeholder=""
                v-model="pageData.dropDownData" @press-enter="huiche" />
            </a-form-item>
          </a-form>
        </div>
        <div>
          <Toolbar :items="pageData.btnList" @add="addHandler" @import="importHandler" @del="deleteHandler"
            @select="selectHandler" @export="exports" @excel="downloadHandler">
          </Toolbar>
        </div>
      </div>
      <div class="my-divisders">
        <a-divider orientation="center">
          <icon-double-up v-if="headerShow" @click="headerShow = false" :strokeWidth="2" :size="18" />
          <icon-double-down v-else @click="headerShow = true" :strokeWidth="2" :size="18" />
        </a-divider>
      </div>
      <div class="my-tool-bar">
        <!-- <Toolbar :items="pageData.btnList" @add="addHandler" @import="importHandler" @del="deleteHandler"
                        @select="selectHandler" @export="exports" @excel="downloadHandler">
                    </Toolbar> -->
      </div>
    </template>

    <template #pageTabel>
      <!-- <a-table style="height: 100%;" :scrollbar="true" sticky-header @page-change="pagination.change"
                            stripe :bordered="true" :columns="tableColumns" @change="handleChange"
                            :draggable="{ type: 'handle', width: 20, fixed: true }"
                            :row-selection="{ showCheckedAll: true, width: 50, onlyCurrent: true }"
                            v-model:selected-keys="selectedRowKeys" :loading="pageData.pageLoading" :data="table.dataList"
                            size="mini" :pagination="false" :rowKey="rowKey">
                            <template #action="{ record }">
                                <a-button type="primary" size="small" status="warning" @click="editHandler(record)"
                                    :disabled="!pageData.isEdit">
                                    <template #icon>
                                        <icon-edit />
                                    </template>
                                    修 改
                                </a-button>
                            </template>
                        </a-table> -->
      <a-spin :loading="pageData.pageLoading" tip="加载中" dot style="height: 100%; width: 100%; z-index: 999">
        <AgGridVuesCopys :rowHeight="33" :headerHeight="33" :suppressCopyRowsToClipboard="true" :suppressDragLeaveHidesColumns="true" rowSelection="multiple"
          @grid-ready="gridReady" style="height: 100%" :defaultColDef="defaultColDef" class="ag-theme-alpine"
          :rowData="table.dataList" @columnVisible="onColumnVisible" :columnDefs="tc" :localeText="localeText1"
          @columnResized="onColumnResized" @columnMoved="onColumnMoved">
        </AgGridVuesCopys>
      </a-spin>
    </template>
    <paginationCopys :total="total" show-total show-jumper show-page-size @change="PageSize" @page-size-change="change1"
      style="justify-content: center" :page-size="pagination.pageSize" :current="pagination.page"
      :page-size-options="pagingList1" />

    <a-drawer style="z-index: 999" ok-text="保存" cancel-text="关闭" :drawer-style="{ zIndex: 9999 }" :mask-closable="false"
      :width="400" :visible="pageData.showAdd" unmountOnClose @ok="sideOk" @cancel="pageData.showAdd = false"
      :ok-loading="pageData.pageLoading">
      <template #title>
        {{ pageData.sideTitle }}
      </template>
      <div>
        <a-form ref="formRef" layout="horizontal" :model="dataForm" :width="500" :label-col-props="{ span: 7 }"
          :wrapper-col-props="{ span: 17 }">
          <a-form-item label="项目名称" field="propertyName" :rules="[{ required: true, message: '项目名称必填' }]"
            :validate-trigger="['change', 'blur']">
            <a-select popup-container="html"  class="bacClass" :loading="loading1" placeholder="" @search="handleSearch1"
              v-model="dataForm.propertyName" :filter-option="false" allow-search allow-clear @focus="focusSel1">
              <a-option v-for="item in pageData.DefectNameList1" :value="item['projectName']">{{ item['projectName'] }}
              </a-option>
            </a-select>
          </a-form-item>
          <a-form-item label="备注" field="remark">
            <a-textarea class="bacClass" placeholder="" v-model="dataForm.remark" :max-length="400" allow-clear
              show-word-limit />
          </a-form-item>

          <div style="margin-bottom: 10px">
            <a-button type="primary" size="small" @click="handleAdd">添加检验项</a-button>
          </div>
          <a-form-item v-for="(item, index) in pageData.checkoutList" :key="index" :label="`检验项-${index}`"
            :rules="[{ validator: blurInput }, { required: true, message: '检验项详情必填' }]"
            :validate-trigger="['change', 'blur']">
            <a-input class="bacClass" v-model="item['checkout']" placeholder="" />
            <a-button type="primary" status="danger" @click="handleDelete1(index)" :style="{ marginLeft: '10px' }">
              <template #icon>
                <icon-delete style="font-size: 20px" />
              </template>
            </a-button>
          </a-form-item>
          <a-form-item v-for="(post, index) of dataForm.posts" :field="`posts.${index}.value`" :label="`检验项-${index}`"
            :key="index" :rules="[{ validator: blurInput }, { required: true, message: '检验项详情必填' }]"
            :validate-trigger="['change', 'blur']">
            <a-input class="bacClass" v-model="post.value" placeholder="" />
            <a-button type="primary" status="danger" @click="handleDelete(index)" :style="{ marginLeft: '10px' }">
              <template #icon>
                <icon-delete style="font-size: 20px" />
              </template>
            </a-button>
          </a-form-item>
        </a-form>
      </div>
    </a-drawer>
  </pageTabelLayout>
</template>

<script lang="ts">
import { post } from '@/api/http'
import { useTable, useRowKey, useTableColumn, usePagination, useRowSelection } from '@/hooks/table'

import { ref, reactive, onMounted, onActivated, onUnmounted } from 'vue'
import Toolbar from '@/components/Toolbar.vue'
import { Form, Message, Modal } from '@arco-design/web-vue'
import { FormInstance } from '@arco-design/web-vue/es/form'
import emitter from '@/hooks/useEventBus'
import validate from '@/hooks/useValidate'
import { DatasetComponent } from 'echarts/components'
import { baseURL } from '../../../api/axios.config'
import axios from 'axios'
import usePermission from '@/store/modules/permission'

import filedownload from 'js-file-download'
import { localeText } from '@/api/aggridZw'
import { pagingList } from '@/api/paging'
import { saveOrUpdateGridState as saveOrUpdateGridState01 } from '@/hooks/useGridState'
interface DefectName {
  checkout: string | undefined
  propertyName: any
  createTime: string | undefined
  updateTime: string | undefined
  id: any
  updateName: string | undefined
  createName: string | undefined
  deleteState: number | undefined
  posts: any[]
  remark: string | undefined
}

export default {
  name: 'DetailsInspectionitems',
  setup() {
    //查询
    const scrollbar = ref(true)
    const { selectedRowKeys, onSelectionChange } = useRowSelection()
    const pagination = usePagination(doRefresh)
    const table = useTable()
    const rowKey = useRowKey('id')
    //检验表单是否含有中文的方法
    const hasChiese = validate.includeChinese
    var tableColumns = useTableColumn([
      {
        title: '序号',
        key: 'serialNo',
        dataIndex: 'serialNo',
        width: 150,
      },
      {
        title: '项目名称',
        key: 'propertyName',
        dataIndex: 'propertyName',
        width: 150,
      },
      {
        title: '检验项',
        key: 'checkout',
        dataIndex: 'checkout',
        width: 150,
      },
      {
        title: '备注',
        key: 'remark',
        dataIndex: 'remark',
        width: 150,
      },
      {
        title: '创建人',
        key: 'createName',
        dataIndex: 'createName',
        width: 150,
      },
      {
        title: '创建时间',
        key: 'createTime',
        dataIndex: 'createTime',
        width: 200,
      },
      {
        title: '最后修改人',
        key: 'updateName',
        dataIndex: 'updateName',
        width: 150,
      },
      {
        title: '最后修改时间',
        key: 'updateTime',
        dataIndex: 'updateTime',
        width: 200,
      },

      {
        title: '操作',
        key: 'id',
        dataIndex: 'id',
        slotName: 'action',
        width: 150,
        fixed: 'right',
      },
    ])
    const scroll = {
      x: 2000,
      y: 200,
    }
    let tc: any[] = tableColumns.map((o) => {
      let obj = {
        headerName: o.title,
        field: o.key,
        pinned: o['fixed'],
        tooltipField: o.key,
      }
      obj['width'] = 250
      if (o.slotName === 'action') {
        obj['resizable'] = false
        obj['filter'] = false
        obj['sortable'] = false
        obj['lockPosition'] = 'right'
        obj['width'] = 80
        obj['cellRenderer'] = {
          template: `<el-button style="color:#165dff;"  v-if="isEdit" link @click="a">修改</el-button>`,
          setup(props: any) {
            const isEdit = ref(pageData.isEdit)
            const a = () => {
              editHandler(props.params.data)
            }
            return {
              isEdit,
              a,
            }
          },
        }
      }

      return obj
    })

    let a = [
      {
        showRowGroup: 'hide_def',
        headerName: '',
        checkboxSelection: true,
        headerCheckboxSelection: true,
        pinned: 'left',
        width: 50,
        resizable: false,
        filter: false,
        sortable: false,
        minWidth: 50,
        maxWidth: 50,
        lockPosition: 'left',
      },
    ]
    tc = a.concat(tc)
    const tablediv = ref(null)
    const pageData = reactive<{
      DefectName: DefectName[]
      showAdd: boolean
      sideTitle: string
      pageLoading: boolean
      height: number
      tablediv: any
      rHeight: number | undefined
      DefectNameList: []
      dropDownData: any
      checkoutList: any[] | undefined
      DefectNameList1: []
      btnList: any[]
      isEdit: boolean
    }>({
      DefectName: [],
      showAdd: false,
      sideTitle: '新增检验项目详情',
      pageLoading: false,
      height: 0,
      tablediv: null,
      rHeight: 0,
      DefectNameList: [],
      dropDownData: '',
      checkoutList: [],
      DefectNameList1: [],
      btnList: [],
      isEdit: false,
    })
    const total = ref(0)
    const page = ref(1)
    const size = ref(10)
    function PageSize(val: any) {
      pagination.page = val
      doRefresh()
    }
    function change1(val: any) {
      pagination.pageSize = val
      doRefresh()
    }
    function doRefresh() {
      pageData.pageLoading = true
      updateGridState01()
      post({
        url: 'qms/incomVerifyDetails/selectPage',
        data: {
          page: pagination.page,
          size: pagination.pageSize,
          deleteState: 0,
          propertyName: cxbl,
        },
      })
        .then(({ data, code }: any) => {
          if (code === 200) {
            table.handleSuccess(data.list)
            gridOption.value.setRowData(data.list)
            //pagination.setTotalSize(data.total);
            total.value = data.total
          }
        })
        .catch(console.log)
        .finally(() => {
          pageData.pageLoading = false
        })
    }

    //下拉框得到焦点
    const focusSel = () => {
      selCxAll({ propertyName: '' })
    }
    //下拉数据
    const options = ref<any>(pageData.DefectNameList)
    const loading = ref(false)
    const handleSearch = (value: any) => {
      if (value) {
        const ob = { propertyName: value }
        loading.value = true
        window.setTimeout(() => {
          selCxAll(ob)
          options.value = pageData.DefectNameList
          loading.value = false
        }, 200)
      } else {
        options.value = []
      }
    }

    //下拉框查询
    function selCxAll(val: any) {
      post({
        url: 'qms/incomVerifyDetails/getFieldValue',
        data: val,
      }).then(({ data, code }: any) => {
        if (code === 200) {
          // (data as string[]).splice(0, 0, "全部");
          pageData.DefectNameList = data
        } else {
          Message.error({
            content: '查询失败！',
            duration: 5000,
          })
        }
      })
    }

    onMounted(() => {
      emitter.on('refresh-DetailsInspectionitems', () => {
        selCxAll({ propertyName: '' })
      })
      pageData.rHeight = document.getElementById('masterDataSettings')?.clientHeight
      //表格的高
      if (pageData.rHeight !== undefined) {
        pageData.rHeight = pageData.rHeight - 200
      }
      window.addEventListener('resize', () => {
        pageData.rHeight = document.getElementById('masterDataSettings')?.clientHeight
        //表格的高
        if (pageData.rHeight !== undefined) {
          pageData.rHeight = pageData.rHeight - 200
        }
      })
      doRefresh()
    })
    let cxbl = ''
    //查询
    const selectHandler = () => {
      pagination.page = 1
      cxbl = pageData.dropDownData
      doRefresh()
    }

    const addHandler = () => {
      selCxAll1({ projectName: '' })
      pageData.checkoutList = []
      for (var key in dataForm) {
        if (key === 'id') {
          dataForm[key] = null
        } else if (key === 'deleteState' || key === 'donationMoney' || key === 'deleteDonation') {
          dataForm[key] = 0
        } else if (key == 'posts') {
          dataForm[key] = []
        } else {
          dataForm[key] = ''
        }
      }
      pageData.showAdd = true
      pageData.sideTitle = '新增检验项目详情'
    }
    const dataForm = reactive<DefectName>({
      checkout: '',
      propertyName: '',
      createTime: '',
      updateTime: '',
      id: null,
      updateName: '',
      createName: '',
      deleteState: 0,
      posts: [],
      remark: '',
    })
    const handleAdd = () => {
      dataForm.posts.push({
        value: '',
      })
    }
    const handleDelete = (index: any) => {
      dataForm.posts.splice(index, 1)
    }
    const handleDelete1 = (index: any) => {
      console.log(index)
      pageData.checkoutList?.splice(index, 1)
      // console.log(pageData.checkoutList);
    }

    // 表格准备事件
    const gridOption = ref()
    const colState = ref()
    const gridReady = (params: any) => {
      gridOption.value = params.api
      colState.value = params.columnApi
    }

    const formRef = ref<FormInstance>()
    const sideOk = () => {
      formRef.value?.validate().then((err) => {
        if (!err) {
          pageData.pageLoading = true
          //将多个用户填写的经验项传给后端
          dataForm['checkout'] = ''
          if (pageData['checkoutList']?.length !== 0 && pageData['checkoutList'] !== undefined) {
            for (let i = 0; i < pageData['checkoutList'].length; i++) {
              dataForm['checkout'] += '/' + pageData['checkoutList'][i]['checkout']
            }
          }
          dataForm['posts'].forEach(function (o) {
            dataForm['checkout'] += '/' + o['value']
          })
          dataForm['checkout'] = dataForm['checkout']?.replace('/', '')
          if (pageData.sideTitle === '新增检验项目详情') {
            post({
              url: 'qms/incomVerifyDetails/insert',
              data: [dataForm],
            })
              .then((res: any) => {
                if (res.code === 200) {
                  formRef.value?.resetFields()

                  pageData.showAdd = false

                  Message.success({
                    content: '新增成功',
                    duration: 5000,
                  })
                  doRefresh()
                } else {
                  Message.error({
                    content: res.message,
                    duration: 5000,
                  })
                }
                doRefresh()
              })
              .finally(() => {
                doRefresh()
                pageData.pageLoading = false
              })
          } else {
            pageData.pageLoading = true
            post({
              url: 'qms/incomVerifyDetails/update',
              data: [dataForm],
            })
              .then((res: any) => {
                if (res.code === 200) {
                  formRef.value?.resetFields()
                  pageData.showAdd = false

                  Message.success({
                    content: '修改成功',
                    duration: 5000,
                  })
                  doRefresh()
                } else {
                  Message.error({
                    content: res.message,
                    duration: 5000,
                  })
                }
              })
              .finally(() => {
                doRefresh()
                pageData.pageLoading = false
              })
          }
        }
      })
    }
    const deleteHandler = () => {
      // if (selectedRowKeys.value.length === 0) {
      //     return;
      // }
      if (gridOption.value.getSelectedRows() === 0) {
        return
      }
      Modal.confirm({
        title: '系统提示',
        content: '确认删除选中的数据?',
        onOk() {
          pageData.pageLoading = true
          post({
            url: 'qms/incomVerifyDetails/delete',
            //data: selectedRowKeys.value,
            data: gridOption.value.getSelectedRows().map((o: any) => {
              return o.id
            }),
          })
            .then(({ code, data }: any) => {
              if (code === 200) {
                Message.success({
                  content: '删除成功',
                  duration: 5000,
                })
                pagination.page = 1
                doRefresh()
              } else {
                Message.error({
                  content: '修改失败',
                  duration: 5000,
                })
              }
            })
            .finally(() => {
              pageData.pageLoading = false
            })
        },
      })
    }
    const editHandler = (record: DefectName) => {
      pageData.checkoutList = []
      selCxAll1({ projectName: '' })
      dataForm.posts = []
      var list: any = record.checkout?.split('/')
      for (var i = 0; i < list?.length; i++) {
        var ob = {}
        ob['checkout'] = list[i]
        ob['item'] = i
        pageData.checkoutList?.push(ob)
      }
      dataForm.id = record.id
      dataForm.propertyName = record.propertyName
      dataForm.checkout = record.checkout
      dataForm.remark = record.remark
      pageData.sideTitle = '修改检验项目详情'
      pageData.showAdd = true
    }
    //导出
    const exports = () => {
      // if (selectedRowKeys.value.length === 0) {
      //     Message.error('请先勾选')
      //     return
      // }
      if (gridOption.value.getSelectedRows() === 0) {
        Message.error('请先勾选')
        return
      } else {
        //将表头拼接出来
        let head =
          '<th>项目名称</th><th>检验项</th><th>备注</th><th>创建人</th><th>创建时间</th><th>最后修改人</th><th>最后修改时间</th>'
        //拿到当前表格数据与勾选的行做筛选

        // let nowRow = table.dataList.filter(function (o) {
        //     return selectedRowKeys.value.indexOf(o["id"]) !== -1;
        // })
        let nowRow = gridOption.value.getSelectedRows()
        let body = ''
        nowRow.forEach(function (o: any) {
          body += '<tr><td>' + o['propertyName'] + '</td>'
          body += '<td>' + o['checkout'] + '</td>'
          body += '<td>' + o['remark'] + '</td>'
          body += '<td>' + o['createName'] + '</td>'
          body += '<td>' + o['createTime'] + '</td>'
          body += '<td>' + o['updateName'] + '</td>'
          body += '<td>' + o['updateTime'] + '</td>'
          body += '</tr>'
        })
        tableToXlsx(head, '检验项目详情', body)
      }
    }

    function tableToXlsx(head: any, filename: any, body: any) {
      const uri = 'data:application/vnd.ms-excel;base64,',
        template = `<html>
            <head><meta charset="UTF-8"></head>
            <body><table border="1"><tr>${head}</tr>${body}</table></body>
        </html>`

      const a = document.createElement('a')
      a.href = uri + window.btoa(unescape(encodeURIComponent(template)))
      a.download = filename
      a.click()
      document.removeChild(a)
    }

    //模板下载
    const downloadHandler = () => {
      axios
        .get(baseURL + '/qms/incomVerifyDetails/uploadModel', {
          responseType: 'blob',
          headers: {
            token: sessionStorage.getItem('USER-TOKEN-KEY'),
          },
        })
        .then((res) => {
          if (res.status === 200) {
            filedownload(res.data, '检验项目详情.xlsx')
          }
        })
    }
    //导入
    const importHandler = () => {
      const inputEle: HTMLInputElement = document.createElement('input')
      inputEle.type = 'file'
      inputEle.id = 'fileUploadExcel'
      inputEle.accept =
        'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel'
      inputEle.addEventListener('change', (e) => {
        const formData = new FormData()
        if (inputEle.files !== null) {
          formData.append('file', inputEle.files[0] || '')
        } else {
          Message.warning('未选择文件！')
          return
        }
        pageData.pageLoading = true
        axios
          .post(baseURL + '/qms/incomVerifyDetails/importModelData', formData, {
            headers: {
              'Content-Type': 'multipart/form-data',
              token: sessionStorage.getItem('USER-TOKEN-KEY'),
            },
          })
          .then((result) => {
            if (result.data['code'] === 200) {
              Message.success('导入成功')
            } else {
              Message.error(result.data.message)
            }
          })
          .finally(() => {
            pageData.pageLoading = false
            doRefresh()
          })
      })
      inputEle.click()
    }
    //新增下拉框得到焦点
    const focusSel1 = () => {
      selCxAll1({ projectName: '' })
    }
    //新增下拉数据
    const options1 = ref<any>(pageData.DefectNameList1)
    const loading1 = ref(false)
    const handleSearch1 = (value: any) => {
      if (value) {
        const ob = { projectName: value }
        loading1.value = true
        window.setTimeout(() => {
          selCxAll1(ob)
          options1.value = pageData.DefectNameList1
          loading1.value = false
        }, 200)
      } else {
        options1.value = []
      }
    }

    //新增下拉框查询
    function selCxAll1(val: any) {
      post({
        url: 'qms/incomVerify/select',
        data: val,
      }).then(({ data, code }: any) => {
        if (code === 200) {
          // (data as string[]).splice(0, 0, "全部");
          pageData.DefectNameList1 = data
        } else {
          Message.error({
            content: '查询失败！',
            duration: 5000,
          })
        }
      })
    }

    const blurInput = (value: string, cb: Function) => {
      return new Promise<void>((resolve) => {
        if (window.encodeURI(value).indexOf('/') !== -1) {
          cb('填写的值不能包含 "/" ！')
        }
        var reg = /^[0-9]*$/
        var pattern = new RegExp(reg)
        if (pattern.test(window.encodeURI(value))) {
          cb('填写的值不能全是数字！')
        }
        resolve()
      })
    }
    const headerShow = ref<boolean>(true)
    //设置权限
    // ['查询', '新增', '删除', '导出', '导入']
    const permissionStore = usePermission()

    if (permissionStore.hasPermisson('jyxmxq.cx')) {
      pageData.btnList.push('查询')
    }
    if (permissionStore.hasPermisson('jyxmxq.xz')) {
      pageData.btnList.push('新增')
    }
    if (permissionStore.hasPermisson('jyxmxq.sc')) {
      pageData.btnList.push('删除')
    }
    if (permissionStore.hasPermisson('jyxmxq.dc')) {
      pageData.btnList.push('导出')
    }
    if (permissionStore.hasPermisson('jyxmxq.mbxz')) {
      pageData.btnList.push('模板下载')
    }
    if (permissionStore.hasPermisson('jyxmxq.dr')) {
      pageData.btnList.push('导入')
    }
    if (permissionStore.hasPermisson('jyxmxq.xg')) {
      pageData.isEdit = true
    }
    const handleChange = (_data: any) => {
      table.handleSuccess(_data)
    }
    const defaultColDef = {
      sortable: true,
      resizable: true,
      filter: true,
      //flex: 1
    }
    const localeText1: any = ref(localeText)
    const huiche = () => {
      pagination.page = 1
      cxbl = pageData.dropDownData
      doRefresh()
    }
    const pagingList1: any = ref(pagingList)

    const { saveGridState: saveGridState01, updateGridState: updateGridState01 } = saveOrUpdateGridState01('DetailsInspectionitems', gridOption, colState, tc)
    const onColumnMoved = () => {
      saveGridState01()
    }
    const onColumnResized = () => {
      saveGridState01()
    }
    const onColumnVisible = () => {
      saveGridState01()
    }
    return {
      saveOrUpdateGridState01,
      saveGridState01,
      updateGridState01,
      onColumnMoved,
      onColumnResized,
      onColumnVisible,
      colState,
      pagingList1,
      huiche,
      localeText1,
      headerShow,
      scroll,
      scrollbar,
      tablediv,
      downloadHandler,
      importHandler,
      hasChiese,
      deleteHandler,
      sideOk,
      formRef,
      dataForm,
      addHandler,
      selectedRowKeys,
      pagination,
      tableColumns,
      table,
      rowKey,
      pageData,
      editHandler,
      selectHandler,
      exports,
      handleAdd,
      handleDelete,
      options,
      loading,
      handleSearch,
      focusSel,
      focusSel1,
      options1,
      loading1,
      handleSearch1,
      handleDelete1,
      blurInput,
      PageSize,
      change1,
      handleChange,
      defaultColDef,
      tc,
      gridOption,
      gridReady,
      total,
      permissionStore,
    }
  },
  components: { Toolbar,  },
}
</script>
<style scoped lang="less"></style>
